<?php
/** 
  * Parent Class for all MetaBase Drivers
  */
class ps_MetaBase_Driver {
  protected $config = array();

  function __construct( $config ) {
    $this->applyConfig( $config );
  }

  /**
   * Merge config over the top of default config
   */
  protected function applyConfig( $config ) {
	$this->config = array_merge( $this->config, $config );
  }

  /**
   * Simple Probability Test
   */
  protected function probability($prob, $div = 100) {
   $random = mt_rand( 1, $div );
    return $random <= $prob;
  }

  /**
   * Get Config by value or return entire thing
   */	
  public function getConfig( $key='' ) {
	if ($key) {
		return $this->config[$key];
	} else {
		return $this->config;
	}
  }
}
?>
